package no.sachmuld.methodcombination.examples.reflection.strategy.v2;

import no.sachmuld.methodcombination.api.BehaviourChain;
import no.sachmuld.methodcombination.api.reflection.Default;

/**
 *
 */
public abstract class Duck {

    private BehaviourChain<DuckBehaviour> chain = new BehaviourChain<>();

    final public void fly() {
        new Default<Void>().build(DuckBehaviour.class, Duck.class, "fly").execute(this, chain);
    }

    final public void quack() {
        new Default<Void>().build(DuckBehaviour.class, Duck.class, "quack").execute(this, chain);
    }

    public Duck with(DuckBehaviour... behaviours) {
        chain.addAll(behaviours);
        return this;
    }

}
